home *** CD-ROM | disk | FTP | other *** search
/ Aminet 52 / Aminet 52 (2002)(GTI - Schatztruhe)[!][Dec 2002].iso / Aminet / game / patch / WHDIGamesS-T.lzh / Tetris.lha / TetrisHD / Install-Tetris next >
Text File  |  2002-05-14  |  7KB  |  256 lines

  1. ;****************************
  2.  
  3. (set #sub-dir "data")            ;sub directory containing data files
  4. (set #readme-file "ReadMe")        ;name of readme file
  5. (set #man-file "Manual")        ;name of manual file
  6. (set #hint-file "Hints")        ;name of hint file
  7. (set #sol-file "Solution")        ;name of solution file
  8. (set #highs-file "highs")        ;name of high scores file
  9. (set #prefix @app-name)            ;name of slave, directory
  10. (set #AD_disk "Tetris")
  11.  
  12. ;****************************
  13. ;----------------------------
  14. (procedure P_Install
  15.  (P_disk)
  16.  (copyfiles
  17.    (help @copyfiles-help)
  18.    (source ("%s:" #AD_disk))
  19.    (dest #dest)
  20.    (pattern "~(c|s|#?.info|Trashcan)")
  21.  )
  22. )
  23. ;----------------------------
  24. ; checks if given program is installed, if not abort install
  25. ; #program - to check
  26.  
  27. (procedure P_ChkRun
  28.   (if (= 0 (run ("cd SYS:\nWhich %s >NIL:" #program)))
  29.     ("")
  30.     (abort
  31.       (cat
  32.     "You must install \"" #program "\" first!\n"
  33.     "It must be accessible via the path.\n"
  34.     "You can find it in the WHDLoad package."
  35.       )
  36.     )
  37.   )
  38. )
  39.  
  40. ;----------------------------
  41. ; Wait for inserting disk
  42. ; IN:  #AD_disk - name of disk
  43. ; OUT: -
  44.  
  45. (procedure P_disk
  46.   (askdisk
  47.     (dest #AD_disk)
  48.     (prompt ("\nInsert Disk \"%s\" in any drive!" #AD_disk))
  49.     (help @askdisk-help)
  50.   )
  51. )
  52.  
  53. ;----------------------------
  54. ; copy file including icon if exist
  55. ; #copy-file - name of file to copy
  56.  
  57. (procedure P_CopyFile
  58.   (if (exists #copy-file) (
  59.     (copyfiles
  60.       (help @copyfiles-help)
  61.       (source #copy-file)
  62.       (dest #dest)
  63.     )
  64.     (if (exists ("%s.info" #copy-file)) (
  65.       (copyfiles
  66.         (help @copyfiles-help)
  67.         (source ("%s.info" #copy-file))
  68.         (dest #dest)
  69.       )
  70.       (tooltype
  71.         (dest (tackon #dest #copy-file))
  72.         (noposition)
  73.       )
  74.     ))
  75.   ))
  76. )
  77.  
  78. ;****************************
  79.  
  80. (if (< @installer-version (+ (* 44 65536) 10))
  81.   (
  82.     (message
  83.       (cat
  84.         "Warning: your installer is outdated.\n"
  85.         "Some features of this installation won't be available, "
  86.         "such as icon show and drawer opening. "
  87.         "You have version " (/ @installer-version 65536) "." 
  88.         (BITAND @installer-version 65535) ", recommended is version 44.10. "
  89.         "The 'installer' 44.10 comes with OS 3.5 but is also contained in the NDK 3.9. "
  90.         "You may also use the InstallerNG by Jens Tröger."
  91.         "\n\n"
  92.         "The installers can be obtained from the net:\n"
  93.         "http://www.amiga.com/3.9/download/NDK3.9.lha\n"
  94.         "aminet:util/sys/InstallerNG.lha"
  95.       )
  96.     )
  97.     (set #newstuff 0)
  98.   )
  99.   (set #newstuff 1)
  100. )
  101.  
  102. (if (exists #readme-file)
  103.   (if (= 0 (run ("SYS:Utilities/Multiview %s" #readme-file)))
  104.     ("")
  105.     (run ("SYS:Utilities/More %s" #readme-file))
  106.   )
  107. )
  108.  
  109. (set #program "WHDLoad")
  110. (P_ChkRun)
  111.  
  112. (if (getenv "WHDLInstPath")
  113.   (set @default-dest (getenv "WHDLInstPath"))
  114. )
  115. (set #dest
  116.   (askdir
  117.     (prompt
  118.       (cat
  119.     "Where should \"" @app-name "\" be installed?\n"
  120.     "A drawer \"" #prefix "\" will be automatically created."
  121.       )
  122.     )
  123.     (help @askdir-help)
  124.     (default @default-dest)
  125.   )
  126. )
  127. (run ("setenv WHDLInstPath \"%s\"\ncopy ENV:WHDLInstPath ENVARC:" #dest))
  128. (set #dest (tackon #dest #prefix))
  129. (if (exists #dest) (
  130.   (set #choice
  131.     (askbool
  132.       (prompt
  133.         (cat
  134.           "\nDirectory \"" #dest "\" already exists.\n"
  135.           "Should it be deleted?"
  136.         )
  137.       )
  138.       (default 1)
  139.       (choices "Delete" "Skip")
  140.       (help @askbool-help)
  141.     )
  142.   )
  143.   (if (= #choice 1)
  144.     (delete #dest
  145.       (help @delete-help)
  146.       (all)
  147.     )
  148.   )
  149. ))
  150. (makedir #dest
  151.   (help @makedir-help)
  152.   (infos)
  153. )
  154.  
  155. ;----------------------------
  156.  
  157. (copyfiles
  158.   (help @copyfiles-help)
  159.   (source ("%s.Slave" #prefix))
  160.   (dest #dest)
  161. )
  162. (if (exists ("%s.glowexot"  #prefix)) ((set #icon 7)(set #icnt (+ 1 #icnt))(set #icon-gex "Exotic GlowIcon")) (set #icon-gex ""))
  163. (if (exists ("%s.newexot"   #prefix)) ((set #icon 6)(set #icnt (+ 1 #icnt))(set #icon-nex "Exotic NewIcon"))  (set #icon-nex ""))
  164. (if (exists ("%s.exoticon"  #prefix)) ((set #icon 5)(set #icnt (+ 1 #icnt))(set #icon-exo "Exoticon"))        (set #icon-exo ""))
  165. (if (exists ("%s.glowicon"  #prefix)) ((set #icon 4)(set #icnt (+ 1 #icnt))(set #icon-glo "Glow Icon"))       (set #icon-glo ""))
  166. (if (exists ("%s.coloricon" #prefix)) ((set #icon 3)(set #icnt (+ 1 #icnt))(set #icon-col "OS3.5 Icon"))      (set #icon-col ""))
  167. (if (exists ("%s.newicon"   #prefix)) ((set #icon 2)(set #icnt (+ 1 #icnt))(set #icon-new "NewIcon"))         (set #icon-new ""))
  168. (if (exists ("%s.romicon"   #prefix)) ((set #icon 1)(set #icnt (+ 1 #icnt))(set #icon-rom "RomIcon"))         (set #icon-rom ""))
  169. (if (exists ("%s.inf"       #prefix)) ((set #icon 0)(set #icnt (+ 1 #icnt))(set #icon-nor "Normal"))          (set #icon-nor ""))
  170. (procedure P_Icon
  171.   (copyfiles
  172.     (help @copyfiles-help)
  173.     (source ("%s.%s" #prefix #icon-suf))
  174.     (newname ("%s.info" #icon-name))
  175.     (dest #icon-dir)
  176.   )
  177.   (tooltype
  178.     (dest (tackon #icon-dir #icon-name))
  179.     (noposition)
  180.   )
  181. )
  182. (if (> #icnt 1) (
  183.   (if (= #newstuff 1) (
  184.     (set #icon-dir ("T:%s Icons" #prefix))
  185.     (makedir #icon-dir
  186.       (help @makedir-help)
  187.     )
  188.     (if #icon-nor ((set #icon-suf "inf")      (set #icon-name "Normal")          (P_Icon)))
  189.     (if #icon-rom ((set #icon-suf "romicon")  (set #icon-name "RomIcon")         (P_Icon)))
  190.     (if #icon-new ((set #icon-suf "newicon")  (set #icon-name "NewIcon")         (P_Icon)))
  191.     (if #icon-col ((set #icon-suf "coloricon")(set #icon-name "OS3.5 Icon")      (P_Icon)))
  192.     (if #icon-glo ((set #icon-suf "glowicon") (set #icon-name "Glow Icon")       (P_Icon)))
  193.     (if #icon-exo ((set #icon-suf "exoticon") (set #icon-name "Exoticon")        (P_Icon)))
  194.     (if #icon-nex ((set #icon-suf "newexot")  (set #icon-name "Exotic NewIcon")  (P_Icon)))
  195.     (if #icon-gex ((set #icon-suf "glowexot") (set #icon-name "Exotic GlowIcon") (P_Icon)))
  196.     (openwbobject #icon-dir)
  197.   ))
  198.   (set #icon
  199.     (askchoice
  200.       (prompt "\nWhich icon would you like to install?\n")
  201.       (choices #icon-nor #icon-rom #icon-new #icon-col #icon-glo #icon-exo #icon-nex #icon-gex)
  202.       (default #icon)
  203.       (help @askchoice-help)
  204.     )
  205.   )
  206.   (if (= #newstuff 1) (
  207.     (closewbobject #icon-dir)
  208.     (delete #icon-dir
  209.       (help @delete-help)
  210.       (all)
  211.     )
  212.   ))
  213. ))
  214. (select #icon
  215.   (set #icon "inf")
  216.   (set #icon "romicon")
  217.   (set #icon "newicon")
  218.   (set #icon "coloricon")
  219.   (set #icon "glowicon")
  220.   (set #icon "exoticon")
  221.   (set #icon "newexot")
  222.   (set #icon "glowexot")
  223. )
  224. (copyfiles
  225.   (help @copyfiles-help)
  226.   (source ("%s.%s" #prefix #icon))
  227.   (newname ("%s.info" #prefix))
  228.   (dest #dest)
  229. )
  230.  
  231. (set #copy-file #readme-file)
  232. (P_CopyFile)
  233. (set #copy-file #man-file)
  234. (P_CopyFile)
  235. (set #copy-file #hint-file)
  236. (P_CopyFile)
  237. (set #copy-file #sol-file)
  238. (P_CopyFile)
  239. (set #dest-org #dest)
  240. (if (= #sub-dir "")
  241.   ("")
  242.   (
  243.     (set #dest (tackon #dest #sub-dir))
  244.     (makedir #dest
  245.       (help @makedir-help)
  246.     )
  247.   )
  248. )
  249. (set #copy-file #highs-file)
  250. (P_CopyFile)
  251. (P_Install)
  252. (if (= #newstuff 1)
  253.   (openwbobject #dest-org)
  254. )
  255. (exit)
  256.